home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / psion / bistro3p.opl < prev    next >
Text File  |  1995-03-31  |  2KB  |  128 lines

  1. REM APP Bistro 
  2. REM TYPE 0 
  3. REM ICON "\opd\bistro.pic" 
  4. REM ENDA 
  5.  
  6. PROC BISTRO3: 
  7. local pr$(12,9),pmt(12),p$(9),m$(200) 
  8. local tot,a,p%,np%,i%,j%,q% 
  9.  
  10. np%=0 
  11. layout: 
  12. p$="MarkE" 
  13. i%=3 
  14. j%=2 
  15. do 
  16.   if i%>8 
  17.     i%=3 
  18.     j%=22 
  19.   endif 
  20.   AT j%,i% 
  21.   print np%+1;":"; 
  22.   trap edit p$ 
  23.   if err 
  24.     break 
  25.   elseif p$="" 
  26.     break 
  27.   endif 
  28.   np%=np%+1 
  29.   m$=m$+p$+"," 
  30.   pr$(np%)=p$ 
  31.   p$="" 
  32.   if np%=12 
  33.     beep 5,300 
  34.     giprint "Maximum guests" 
  35.     i%=i%+1 
  36.     break 
  37.   endif 
  38.   i%=i%+1 
  39. until 0 
  40. m$=m$+"All,Each,Tax,Show,Quit" 
  41. do 
  42.   cls 
  43.   layout: 
  44.   do 
  45.     a=0:p%=1 
  46.     dinit "Menu Item" 
  47.     dchoice p%,"For:",m$ 
  48.     dfloat a,"Price:",0,99.99 
  49.     dialog 
  50.     if (a=0) and (P%=np%+4) 
  51.       break 
  52.     endif 
  53. REM --------------- ALL 
  54.     if p%=np%+1 
  55.       tot=tot+a 
  56.       a=a/np% 
  57.       p%=1 
  58.       while p%<=np% 
  59.         pmt(p%)=pmt(p%)+a 
  60.         p%=p%+1 
  61.       endwh 
  62. REM --------------- EACH 
  63.     elseif p%=np%+2 
  64.       tot=tot+a*np% 
  65.       p%=1 
  66.       while p%<=np% 
  67.         pmt(p%)=pmt(p%)+a 
  68.         p%=p%+1 
  69.       endwh 
  70. REM --------------- TAX 
  71.     elseif p%=np%+3 
  72.       p%=1 
  73.       while p%<=np% 
  74.         pmt(p%)=pmt(p%)+a*(pmt(p%)/tot) 
  75.         p%=p%+1 
  76.       endwh 
  77.       tot=tot+a 
  78. REM ----------------- QUIT 
  79.     elseif p%=np%+5 
  80.         beep 5,300 
  81.         dinit 
  82.         dtext "Quit","Bistro",$201 
  83.         dbuttons "Yes",%Y,"No",%N 
  84.         q%=dialog 
  85.         if q%=%Y or q%=%y 
  86.           return 
  87.         endif 
  88.     else 
  89. REM -------------- Just Add 
  90.       pmt(P%)=pmt(p%)+a 
  91.       tot=tot+a 
  92.     endif 
  93.     at 23,9 
  94.     print "Total:",fix$(tot,2,8) 
  95.   until 0 
  96.   doneit:: 
  97.   cls 
  98.   layout: 
  99.   p%=1 
  100.   j%=1 
  101.   i%=1 
  102.   do 
  103.     if i%>6 
  104.       i%=1 
  105.       j%=22 
  106.     endif 
  107.     at j%,i%+2 
  108.     print pr$(p%)+": "+fix$(pmt(P%),2,8) 
  109.     p%=p%+1: i%=i%+1 
  110.   until (P%>np%) or (p%=13) 
  111.   at 23,9 
  112.   print "Total:";fix$(tot,2,8) 
  113.   get 
  114. until q%=%Y or q%=%y 
  115. endp 
  116.  
  117. proc layout: 
  118. gat 210,2 
  119. gclock off 
  120. gclock on 
  121. gat 45,0 
  122. gpatt -1,150,9,2 
  123. at 14,1 
  124. print " Bistromathics " 
  125. gfill 150,9,2 
  126. endp 
  127.  
  128.